<div class="grid_12">
    <div class="box round first fullpage">
        <h2>Phân quyền nhóm người dùng "<span style="color: red;"><?=$this->group->groups_name?></span>"</h2>
        <div class="block" style="position: relative;">
            <div class="message warning loading">
                <p>Loading...</p>
            </div>
            <div class="dataTables_wrapper">
                <table class="data display datatable">
                    <thead>
                        <tr>
                            <th class="center" width="50">STT</th>
                            <th>Tên trang</th>
                            <th>Chuyên mục</th>
                        </tr>
                    </head>
                    
                    <tbody>
                        <?php 
                        $temp = "";
                        $stt=1; 
                        foreach($this->rules as $rule){ $parity = ($stt%2)?"odd":"even"; ?>                        
                            <?php
                            if($temp=="" || $temp!=$rule->controller_name)
                            {
                                $temp = $rule->controller_name;
                                echo "<tr class='gradeA <?=$parity?>'><td colspan='4' class='ctrl-name'>$temp</td></tr>";
                            }
                            ?>
                        <tr class="gradeA <?=$parity?>">
                            <td class="center"><?=$stt?></td>
                            <td>
                                <input style="margin-right: 20px;" type="checkbox" value="<?=$rule->actions_id?>" class="check-per" <?=($rule->status==1)?"checked='checked'":""?> />
                                <?=$rule->action_name?>
                            </td>       
                            <td style="color: #ccc;"><?=$rule->controller_name?></td>  
                        </tr>
                        <?php $stt++;}?>
                    </tbody>
                </table>
            </div>
            <br />
            <a href="<?=$this->url(array("module"=>"admin","controller"=>"user-group","action"=>"index"),null, true)?>" class="btn btn-black">Quay lại</a>      
        </div>
    </div>
</div>
<div class="dialog-message" title="Thông báo" style="display: none;"></div>

<script>
$(function(){
    $(".check-per").change(function(){
        var link = "<?=$this->url(array("module"=>"admin","controller"=>"user-group","action"=>"change-per"), null, true)?>";
        var act = $(this).val();
        var idgr = <?=$this->group->idgroups?>;        
        $.post(link,{"group":idgr,"act":act}, function(rdata){},"json"); 
    });
})
</script>